package com.atguigu.yygh.oss.controller;


import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.oss.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/admin/oss/file")
public class FileUploadController {

    @Autowired
    private FileUploadService fileUploadService;


    @PostMapping("/upload")
    public Result upload ( MultipartFile file) {
        String url = fileUploadService.upload(file);
        return Result.ok().data("url",url);
    }
}
